package cn.caidabao.camunda_demo.service.impl;

import cn.caidabao.camunda_demo.pojo.po.TCaiProcess;
import cn.caidabao.camunda_demo.mapper.TCaiProcessMapper;
import cn.caidabao.camunda_demo.service.ITCaiProcessService;
import cn.caidabao.camunda_demo.util.ContentShowUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author cai
 * @since 2024-07-16
 */
@Service
@AllArgsConstructor
public class TCaiProcessServiceImpl extends ServiceImpl<TCaiProcessMapper, TCaiProcess> implements ITCaiProcessService {
    private final ContentShowUtil contentShowUtil;

    @Override
    public TCaiProcess getByCamundaProcessInstanceId(String camundaProcessInstanceId) {
        return this.lambdaQuery().eq(TCaiProcess::getCamundaProcessInstanceId,camundaProcessInstanceId).one();
    }

    @Override
    public List<JSONObject> jsonList() {
        List<TCaiProcess> list = this.list();
        return contentShowUtil.getForm(list);
    }
}
